define(['app'], function( app ) {
    'use strict';

     app.filter("tree2Arr",function(){
         return function(items, labelChild, strSep ){
              var filtered = [];
              if( undefined == labelChild )
                    labelChild = '_child';
                if( undefined == strSep )
                    strSep = "—  ";

              var recursiveFilter = function(items, rt){
                    rt +=1;
                  angular.forEach(items,function(item){
                    item.rep = strSep.repeat( rt-1 );
                    filtered.push(item);
                     if(angular.isArray(item._child) && item._child.length > 0){
                        recursiveFilter(item._child,rt);
                     }
                  });
              };
              recursiveFilter(items,0);
              return filtered;
           };
    });

});